from fastapi import Request, Response
from fastapi.routing import APIRoute
from afast_core.core_libs.classy_apirouter.group_router import RestInjectForAPIRouter, RestInjectForDocRouter
from infirmary_admin_src.infirmary_common.infirmary_controller import IBaseController
from afast_core.core_libs.classy_apirouter import IHookGroupBaseController
from afast_core.core_libs.classy_apirouter import get, post
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.system.employee.controllers.add import \
    SystemEmployeeAddController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.system.employee.controllers.batch_del import \
    SystemEmployeeBatchDeleteController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.system.employee.controllers.password_reset import \
    SystemEmployeePasswordResetController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.system.employee.controllers.query import \
    SystemEmployeeQueryController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.system.employee.controllers.query_all import \
    SystemEmployeeQueryAllController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.system.employee.controllers.update import \
    SystemEmployeeUpdateController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.system.employee.controllers.update_batch_department import \
    SystemEmployeeBatchdepartmentController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.system.employee.controllers.update_disabled import \
    SystemEmployeeUpdateDisabledController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.system.menu.controllers.auth_url import \
    SystemMenuAuthUrlController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.system.menu.controllers.menu_add import \
    SystemMenuAddController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.system.menu.controllers.menu_batchdelete import \
    SystemMenuBatchdeleteController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.system.menu.controllers.menu_query import \
    SystemMenuQueryController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.system.menu.controllers.menu_tree import \
    SystemMenuTreeController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.system.menu.controllers.menu_update import \
    SystemMenuUpdateController


#  tags=['测试类装饰器依赖项']

@RestInjectForAPIRouter(prefix='/employee')
@RestInjectForDocRouter(tags=['后台系统-人员管理模块'])
class AGroupAPIRouterBuilder(IHookGroupBaseController):
    # 定义公共全局的可用的服务，通过request对象进行透传当前的self

    async def before_request(self, curr_apiroute: APIRoute, request: Request) -> None:
        """如果需要修改请求信息，可直接重写此方法"""
        pass
        request.state.api_router_builder = self
        # 如果存在body对象的，在这里读取一下，以备后续的使用
        request.state.schema_param_body = await request.body()
        print("request.state.schema_param_body ", request.state.schema_param_body)

    async def after_request(self, request: Request, response: Response) -> None:
        """请求后的处理"""
        pass

    @post("/query", summary='菜单模块-菜单列表信息获取')
    def admin_employee_query(self, controller: IBaseController = SystemEmployeeQueryController):

        return controller.sync_response()

    @get("/queryAll", summary='菜单模块-菜单列表信息获取')
    def admin_employee_queryAll(self, controller: IBaseController = SystemEmployeeQueryAllController):
        return controller.sync_response()

    @post("/add", summary='菜单模块-菜单列表信息获取')
    def admin_employee_add(self, controller: IBaseController = SystemEmployeeAddController):
        return controller.sync_response()

    @post("/update/batch/delete", summary='菜单模块-菜单列表信息获取')
    def admin_employee_update_batch_delete(self, controller: IBaseController = SystemEmployeeBatchDeleteController):
        return controller.sync_response()

    @post("/update", summary='菜单模块-菜单列表信息获取')
    def admin_employee_update(self, controller: IBaseController = SystemEmployeeUpdateController):
        return controller.sync_response()


    @get("/update/disabled/{id}", summary='菜单模块-菜单列表信息获取')
    def admin_employee_update_disabled(self, controller: IBaseController = SystemEmployeeUpdateDisabledController):

        return controller.sync_response()

    @get("/update/password/reset/{id}", summary='菜单模块-菜单列表信息获取')
    def admin_employee_update_password_reset(self, controller: IBaseController = SystemEmployeePasswordResetController):
        return controller.sync_response()

    @post("/update/batch/department", summary='菜单模块-批量修改跳转部门')
    def admin_employee_update_batch_department(self, controller: IBaseController = SystemEmployeeBatchdepartmentController):
        return controller.sync_response()
    #
